package com.homegoods.videomodule.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;

import com.cyt.chattlibrary.face.SmileyParser;
import com.cyt.chattlibrary.inputboard.CommentSoftInputLayout;
import com.homegoods.videomodule.R;
import com.kedll.library.KBaseActivity;

/**
 * @author QiQi
 * @ClassName: SendCommentActivity
 * @date 2018/10/16
 * @description
 */
public class SendCommentActivity extends KBaseActivity {

    @Override
    protected int getLayout() {
        return R.layout.video_send_comment;
    }

    @Override
    protected void initData(Bundle savedInstanceState) {
        CommentSoftInputLayout chatSoftInputLayout = findViewById(R.id.softinputLayout);
        chatSoftInputLayout.setOnSendClickListener(text -> {
            sendComment(text);
            finish();
            overridePendingTransition(R.anim.hold, R.anim.bottom_out_600);
        });
    }

    private void sendComment(String mComment) {
        if (TextUtils.isEmpty(mComment)) {
            return;
        }
        SmileyParser parser = SmileyParser.getInstance();
        String comment = parser.getExpressionString(mComment);
        Intent intent = new Intent();
        intent.putExtra("result", comment);
        setResult(RESULT_OK, intent);
    }

    @Override
    protected void initEvent() {

    }
}
